package com.zgm.ch05.aop.pointcutAdvisor.regexMatch._4_1_6;

import org.springframework.aop.Advisor;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.aop.support.JdkRegexpMethodPointcut;

import com.zgm.ch05.aop.pointcutAdvisor._4_1_3.SimpleAdvice;

public class RegexpPointcutExample {

	public static void main(String[] args) {
		RegexBean target = new RegexBean();
		
		JdkRegexpMethodPointcut pc = new JdkRegexpMethodPointcut();
		pc.setPattern(".*foo.*");//????
		Advisor advisor = new DefaultPointcutAdvisor(pc, new SimpleAdvice());
		
		ProxyFactory pf = new ProxyFactory();
		pf.setTarget(target);
		pf.addAdvisor(advisor);
		
		RegexBean proxy = (RegexBean) pf.getProxy();
		proxy.foo1();
		proxy.foo2();
		proxy.bar();
		
	}
}
